package www.wxwnb.clerk.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

import www.wxwnb.clerk.R;
import www.wxwnb.clerk.base.BaseActivity;

/**
 * Created by lenovo on 2017/9/12.
 */

public class ItemAdapter extends BaseAdapter {
    Context context;
    ArrayList<String> list;
    private TextView title;

    public ItemAdapter(Context context, ArrayList<String> list) {
        this.context=context;
        this.list=list;
    }

    @Override
    public int getCount() {
        return list==null?0:list.size();
    }

    @Override
    public Object getItem(int i) {
        return i;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view=View.inflate(context, R.layout.list_item,null);
        title = view.findViewById(R.id.txt_list_item);
        title.setText(list.get(i));
        return view;
    }
}
